package de.islanders.tests;

import junit.framework.Assert;

import org.junit.Test;

import de.islanders.world.DaytimeExchange;

public class DaytimeExchangeTest {

	@Test
	public void test() {
		DaytimeExchange time = DaytimeExchange.getInstance();
		
		time.setSeconds(0);
		time.setMinutes(0);
		time.setHours(5);
		time.updateDayState();

		Assert.assertEquals(time.getDayState(), DaytimeExchange.DAYTIME_NIGHT);
		
		time.setHours(7);
		time.updateDayState();
		Assert.assertEquals(time.getDayState(), DaytimeExchange.DAYTIME_DAWN);
		
		time.setHours(11);
		time.updateDayState();
		Assert.assertEquals(time.getDayState(), DaytimeExchange.DAYTIME_MORNING);
		
		time.setHours(13);
		time.updateDayState();
		Assert.assertEquals(time.getDayState(), DaytimeExchange.DAYTIME_NOON);
		
		time.setHours(20);
		time.updateDayState();
		Assert.assertEquals(time.getDayState(), DaytimeExchange.DAYTIME_AFTERNOON);
		
		time.setHours(21);
		time.updateDayState();
		Assert.assertEquals(time.getDayState(), DaytimeExchange.DAYTIME_DAWN);
		
		time.setHours(22);
		time.updateDayState();
		Assert.assertEquals(time.getDayState(), DaytimeExchange.DAYTIME_NIGHT);
		
		
		//time.run();
	}
}


/*
	public void updateDayState() {
		if(hours <= 5 || hours > 21) {
			dayState = DAYTIME_NIGHT;
		} else if((hours > 5 && hours <= 7) || (hours > 20 && hours <= 21)) {
			dayState = DAYTIME_DAWN;
		} else if(hours > 7 && hours <= 11) {
			dayState = DAYTIME_MORNING;
		} else if(hours > 11 && hours <= 13){
			dayState = DAYTIME_NOON;
		} else if(hours > 13 && hours <= 20) {
			dayState = DAYTIME_AFTERNOON;
		}
	}
*/